﻿<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>

<%@ include file="/core/taglibs.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
  
<head>
 	<%@ include file="/core/memberMeta.jsp"%>
	<script type="text/javascript" src="<%=basePath%>/resources/js/jquery-1.4.js"></script>
    <link href="<%=basePath%>/resources/js/zTree/zTreeStyle.css" rel="stylesheet"/>
	<script src="<%=basePath%>/resources/js/zTree/jquery.ztree-2.6.min.js" type="text/javascript"></script>
		
	<script type=text/javascript>
			var zTree ;
			var setting;
			var zNodes =[];

			setting = {
			
				async: true,
				
				isSimpleData : true,
				treeNodeKey : "id",
				treeNodeParentKey : "fatherId",
				
				//访问路径
				asyncUrl: "<%=basePath%>/member/member/ajaxTuRecommend.shtml",    				//获取节点数据的URL地址
				asyncParam: ["id"],        	     						//获取节点数据时，必须的数据名称，例如：id、name
				asyncParamOther: ["loginName","${loginName}"],        	//其它参数 ( key, value 键值对格式)
				callback:{
					asyncSuccess: zTreeOnAsyncSuccess,
					expand: zTreeOnExpand
				}
			};
	
			
			
			$(document).ready(function(){
				
				refreshTree();
			});
			
			//异步返回的数据
			function zTreeOnAsyncSuccess(event, treeId, treeNode, msg) {
				 
				zTree.expandNode(treeNode, false, false,false);
			}

			//刷新数据
			function refreshTree(asyncUrl) {
				
				setting.asyncUrl = "<%=basePath%>/member/member/ajaxTuRecommend.shtml";
				setting.asyncDataFilter = dataFilter;
				
				zTree = $("#recommendTree").zTree(setting, zNodes);
				
			}
			
			//数据过滤
			function dataFilter(treeId, parentNode, childNodes) {
				childNodes=childNodes.menuList;
				
				return childNodes;
			}

			
			
			
			//展开的时候增加孙子
			function zTreeOnExpand(event, treeId, treeNode) {
				
				var nodes = zTree.getNodesByParam("fatherId", treeNode.id, treeNode);
				 
				for(var i =0; i<nodes.length; i++) {
					if(nodes[i].childNum>0){
						nodes[i].isParent=true;
						zTree.updateNode(nodes[i])
						zTree.reAsyncChildNodes(nodes[i], "refresh");
					}else{
						nodes[i].isParent=false;
					}
					
					
				}
			}
	</script> 
</head>

<body data-type="widgets">
    <script src="<%=basePath%>/resources/memberCss/assets/js/theme.js"></script>
    <div class="am-g tpl-g" style="color: white;">
        
        <!-- 内容区域 -->
        <div class="tpl-content-wrapper" style="color: white;">

            <div class="container-fluid am-cf">
                <div class="row">
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                        <div class="page-header-heading"><span class="am-icon-user page-header-heading-icon"></span> 我的推荐图</div>
                        <p class="page-header-description">欢迎光临BHP必和必拓矿业投资中国区</p>
                    </div>
                     
                </div>

            </div>

            <div class="row-content am-cf" style="color: white;">

                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12" style="color: white;">
                    <div class="widget  am-cf" style="color: white;">
                        
                       
						<div class="widget-body  am-fr">
							<div class="am-scrollable-horizontal ">
								<div id="recommendTree" class="tree" style="color: white;"></div>
							</div>
  							<iframe id="show" name="show" src="member/member/tuRecommendShow.shtml?loginName=${loginName}" frameborder="0"
									width="100%" height="200" scrolling="no"/>
						</div>
                     </div>
                 </div>
             </div>
        </div>
    </div>
    </div>
    <script src="<%=basePath%>/resources/memberCss/assets/js/amazeui2.min.js"></script>
    <script src="<%=basePath%>/resources/memberCss/assets/js/amazeui.datatables.min.js"></script>
    <script src="<%=basePath%>/resources/memberCss/assets/js/dataTables.responsive.min.js"></script>
    <script src="<%=basePath%>/resources/memberCss/assets/js/app.js"></script>

</body>


